package tij4.reusing.source;

class Insect {
    private int i = 9;
    protected int j;

    {
        System.out.println("我是基类Insect的方法块");
    }
    Insect() {
        System.out.println("i = " + i + ", j = " + j);
        j=39;
    }
    private static int x1 = printInit("static Insect.x1 initialized");

    static int printInit(String string) {
        System.out.println(string);
        return 47;
    }
}

public class Beetle extends Insect{
    private int k = printInit("Beetle.k initalized");

    {
        System.out.println("我是导出类Beetle的方法块");
    }
    public Beetle() {
        System.out.println("k = " + k);
        System.out.println("j = " + j);
    }
    private static int x2 = printInit("static Beetle.x2 initialized");

    public static void main(String[] args) {
        System.out.println("Beetle constructor");
        Beetle beetle = new Beetle();
    }
}

/*
    Beetle constructor
    static Insect.x1 initialized    ---- x1=47
    i = 9, j = 0    ---- j=39
    static Beetle.x2 initialized    ---- X2-47
    Beetle.k initalized     ---- K=47
    k = 47
    j = 39



 */
